<template>
  <div class="components-container">
    <sweet-modal ref="dialog" class="dialog">
      <h3>{{title}}</h3>
      <div style=" height:350px; margin:30px 50px">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目名称</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANAME" class="formWide" placeholder="请输入项目名称"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">项目代码</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADM" class="formWide" placeholder="请输入项目代码"></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目类别</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHACYPID" placeholder="请选择项目类别">
                <el-option v-for="item in chargeProjectTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免项目</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHAREDID" placeholder="请选择减免项目">
                <el-option label="不选择" :value="null"></el-option>
                <el-option v-for="item in chaReductionTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">计量单位</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHAAUNIT" placeholder="请选择计量单位">
                <el-option v-for="item in chaUintsTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入单价"></el-input-number>
            </div>
          </div>
        </div>
        <!-- <div class="layui-form-item">
                          <div class="layui-inline">
                            <label class="layui-form-label">起步价</label>
                            <div class="layui-input-inline">
                              <el-input-number v-model="chaData.CHAPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入起步价"></el-input-number>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">最高价</label>
                            <div class="layui-input-inline">
                              <el-input-number v-model="chaData.CHAHIPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入最高价"></el-input-number>
                            </div>
                        </div>
                      </div> -->
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">减免单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAJMMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免单价"></el-input-number>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免限价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAJMHIMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免限价"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item" v-if="!ishidePreferential">
          <div class="layui-inline">
            <label class="layui-form-label">优惠单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHADISCOUNT" :min="-99999" :max="99999" class="formWide" placeholder="请输入优惠单价"></el-input-number>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">优惠限价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAHIDISCOUNT" :min="-99999" :max="99999" class="formWide" placeholder="请输入优惠限价"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">起效日期</label>
            <div class="layui-input-inline">
              <el-date-picker v-date v-model="chaData.CHASTADATE" type="date" placeholder="请输入起效日期"></el-date-picker>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">收费所属</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHFPAYLOGO" placeholder="请选择收费所属">
                <el-option v-for="item in chfpaylogos" :key="item.Value" :label="item.Text" :value="item.Value" />
              </el-select>
            </div>
          </div>
          <!-- <div class="layui-inline">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHANUM" :min="-99999" :max="999" class="formWide" placeholder="请输入排序"></el-input-number>
            </div>
          </div> -->
        </div>
        <div class="layui-form-item">
         <div class="layui-inline">
            <label class="layui-form-label">生产厂家</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHFMANID" placeholder="请选择收费所属">
                <el-option v-for="(item,index) in SccjType" :key="item.VDRID" :label="item.VDRNAME" :value="item.VDRID" />
              </el-select>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
              <el-input type="textarea" v-model="chaData.CHAREMARKS" class="formWide" style="width:478px;" placeholder="请输入备注" />
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item btnCenter">
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" @click="submit" :loading="this.$store.state.isloading">提交</el-button>
      </div>
    </sweet-modal>
    <!-- 详情 -->
    <sweet-modal ref="dialogInfo" class="dialog">
      <h3>{{title}}</h3>
      <div style=" height:370px; margin:30px 50px">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目名称</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANAME" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">项目代码</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADM" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目类别</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CYPNAME" readonly></el-input>
             
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免项目</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.REDNAME" readonly></el-input>
           
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">计量单位</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAAUNIT" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">最高价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAPRICE" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">最低价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAHIPRICE" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">减免单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAJMMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免限价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAJMHIMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">优惠单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADISCOUNT" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">优惠限价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAHIDISCOUNT" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">起效日期</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHASTADATE" readonly />
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANUM" readonly />
            </div>
          </div>
        </div>
        <div class="layui-form-item">
         <div class="layui-inline">
            <label class="layui-form-label">生产厂家</label>
            <div class="layui-input-inline">
                 <el-select v-model="chaData.CHFMANID" placeholder="请选择收费所属" disabled>
                <el-option v-for="(item,index) in SccjType" :key="item.VDRID" :label="item.VDRNAME" :value="item.VDRID" />
              </el-select>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
              <el-input type="textarea" v-model="chaData.CHAREMARKS" class="formWide" style="width:478px;" readonly/>
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item btnCenter">
        <el-button @click="cancel">取消</el-button>
      </div>
    </sweet-modal>
    <!-- 修改收费项目 -->
    <sweet-modal ref="dialogProject" class="dialog">
      <h3>{{title}}</h3>
      <div style=" height:350px; margin:30px 50px">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目名称</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANAME" class="formWide" placeholder="请输入项目名称"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">项目代码</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADM" class="formWide" placeholder="请输入项目代码"></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目类别</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHACYPID" placeholder="请选择项目类别">
                <el-option v-for="item in chargeProjectTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免项目</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHAREDID" placeholder="请选择减免项目">
                <el-option label="不选择" :value="null"></el-option>
                <el-option v-for="item in chaReductionTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">计量单位</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAAUNIT" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <!-- <div class="layui-form-item">
                          <div class="layui-inline">
                            <label class="layui-form-label">起步价</label>
                            <div class="layui-input-inline">
                              <el-input v-model="chaData.CHAPRICE"  class="formWide" readonly></el-input>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">最高价</label>
                            <div class="layui-input-inline">
                              <el-input v-model="chaData.CHAHIPRICE"  class="formWide" readonly></el-input>
                            </div>
                        </div>
                      </div> -->
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">减免单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAJMMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免限价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAJMHIMONEY" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">优惠单价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADISCOUNT" class="formWide" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">优惠限价</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHAHIDISCOUNT" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">起效日期</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHASTADATE" readonly />
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHANUM" :min="-99999" :max="999" class="formWide" placeholder="请输入排序"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
         <div class="layui-inline">
            <label class="layui-form-label">收费所属</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHFPAYLOGO" placeholder="请选择收费所属">
                <el-option v-for="item in chfpaylogos" :key="item.Value" :label="item.Text" :value="item.Value" />
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">生产厂家</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHFMANID" placeholder="请选择收费所属">
                <el-option v-for="(item,index) in SccjType" :key="item.VDRID" :label="item.VDRNAME" :value="item.VDRID" />
              </el-select>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
              <el-input type="textarea" v-model="chaData.CHAREMARKS" class="formWide" style="width:478px;" placeholder="请输入备注" />
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item btnCenter">
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" :loading="this.$store.state.isloading" @click="submit">提交</el-button>
      </div>
    </sweet-modal>
    <!-- 修改收费项目价格 -->
    <sweet-modal ref="dialogPrice" class="dialog">
      <h3>{{title}}</h3>
      <div style=" height:350px; margin:30px 50px">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目名称</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANAME" class="formWide" placeholder="请输入项目名称" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">项目代码</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHADM" class="formWide" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">项目类别</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CYPNAME" readonly></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免项目</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.REDNAME" readonly></el-input>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">计量单位</label>
            <div class="layui-input-inline">
              <el-select v-model="chaData.CHAAUNIT" placeholder="请选择计量单位">
                <el-option v-for="item in chaUintsTypes" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入单价"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">最低价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免单价"></el-input-number>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">最高价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAHIPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免限价"></el-input-number>
            </div>
          </div>
        </div>
        <!-- <div class="layui-form-item">
                          <div class="layui-inline">
                            <label class="layui-form-label">起步价</label>
                            <div class="layui-input-inline">
                              <el-input-number v-model="chaData.CHAPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入起步价"></el-input-number>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">最高价</label>
                            <div class="layui-input-inline">
                              <el-input-number v-model="chaData.CHAHIPRICE" :min="-99999" :max="99999" class="formWide" placeholder="请输入最高价"></el-input-number>
                            </div>
                        </div>
                      </div> -->
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">减免单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAJMMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免单价"></el-input-number>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">减免限价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAJMHIMONEY" :min="-99999" :max="99999" class="formWide" placeholder="请输入减免限价"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item" v-if="!ishidePreferential">
          <div class="layui-inline">
            <label class="layui-form-label">优惠单价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHADISCOUNT" :min="-99999" :max="99999" class="formWide" placeholder="请输入优惠单价"></el-input-number>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">优惠限价</label>
            <div class="layui-input-inline">
              <el-input-number v-model="chaData.CHAHIDISCOUNT" :min="-99999" :max="99999" class="formWide" placeholder="请输入优惠限价"></el-input-number>
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">起效日期</label>
            <div class="layui-input-inline">
              <el-date-picker v-date v-model="chaData.CHASTADATE" type="date" placeholder="请输入起效日期"></el-date-picker>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
              <el-input v-model="chaData.CHANUM" readonly />
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
              <el-input type="textarea" v-model="chaData.CHAREMARKS" class="formWide" style="width:478px;" placeholder="请输入备注" />
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item btnCenter">
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" @click="submit" :loading="this.$store.state.isloading">提交</el-button>
      </div>
    </sweet-modal>
     <sweet-modal ref="dialogaddPrice" class="dialog" >
      <h3>{{ title }}</h3>
      <div style="min-height:200px; margin:30px 50px">
        <div class="layui-form-item">
          <div class="layui-inline">
                <label class="layui-form-label">收费项目</label>
                <div class="layui-input-inline">
                   <!-- <el-select v-model="userData.RTFCHAID" placeholder="收费项目" disabled>
                        <el-option v-for="item in chargepro" :key="item.CHAID" :label="item.CHANAME" :value="item.CHAID"></el-option>
                    </el-select> -->
                 <el-input  v-model="userData.CHANAME" disabled class="formWide"  />
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">减免类型</label>  
                <div class="layui-input-inline">
                    <el-select v-model="userData.RTFRELIEFTYPE" placeholder="减免类型">
                        <el-option v-for="item in chargetype" :key="item.CodeValue" :label="item.CodeName" :value="item.CodeValue"></el-option>
                    </el-select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">现价金额</label>
                <div class="layui-input-inline">
                 <el-input-number v-model="userData.RTFFIXEDPRICE" :min="0" :max="99999" class="formWide" placeholder="请输入单价"></el-input-number>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
              <div class="layui-inline">
              <label class="layui-form-label">现价说明</label>
              <div class="layui-input-inline">
                <el-input type="textarea" v-model="userData.RTFREMARK" class="formWide" style="width:492px;" placeholder="请输入备注" />
              </div>
            </div>
        </div>
      </div>

      <div class="layui-form-item btnCenter" z-index=100>
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="submit" :loading="this.$store.state.isloading">确定</el-button>
      </div>
    </sweet-modal>
  </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
  @import "src/styles/common.scss";
  .el-button+.el-button {
    margin-left: 0;
  }
  .btnCenter {
    text-align: center;
  }
</style>
<script>
  import sweetModal from "@/components/sweetModal";
  import apiBase from "@/api/apiBase.js";
  import {
    formatDate,
    timeStringToDate
  } from "@/utils/date.js";
  const ADD = "新增";
  const MODIFYPROJECT = "修改";
  const MODIFYPRICE = "价格修改";
  const DELETE = "删除";
  const INFO = "详情";
  const CKLSJG = "查看历史价格";
  const ADDPRICE = "新增实收限价";

  export default {
    name: "chargeProjectManageMain",
    data() {
      return {
        title: null,
        loading: false,
        ishidePreferential: null,//控制是否隐藏优惠价格
        chargeProjectTypes: [],
        chfpaylogos: [],
        chaStatusTypes: [],
        chaReductionTypes: [],
        chaUintsTypes: [],
        chaData: {},
        IsDPGPushCHA: null,
        cdhTypeDatas: [],
        // 生产厂家
        SccjType: [],
        //上虞实收现价
        chargetype: [],//减免类型
        chargepro: [],// 收费项目
        userData: {
        RTFRELIEFTYPE:null,   //减免类型
        RTFCHAID:null,    //关联收费项目
        RTFFIXEDPRICE:null,   //限价金额
        RTFREMARK:null,
        },
      };
    },
    methods: {
      //获取减免类型
     getChargepro(){
      apiBase.DoService({}, apiBase.getApiAdress().Code.GetKeyPointType, res => {
        this.chargetype = res.data.content;
      });
    },
     //收费项目
      getAllCharge() {
       let data = {
          Data: {
            REGISKEYPOINT:null
          }
        };
        apiBase.DoService(
         data,
          apiBase.getApiAdress().Checkout.GetAllCharge,
          res => {
            this.chargepro = res.data.content.OutData; //保存的是所有的收费项目
          }
        );
      },
      //获取收费项目类别
      getChargeProjectType() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.QueryType,
          res => {
            let cdhTypeData = res.data.content;
            this.cdhTypeDatas = res.data.content;
            if(this.IsDPGPushCHA){ //义乌
              let datas = [];
              cdhTypeData.forEach(item => {
                if(item.CYPTYPE === "B"){
                  datas.push(item);
                }
              });
              this.chargeProjectTypes = datas.map(item => ({
                label: item.CYPNAME,
                value: item.CYPID
              }))
            }else{
              let legendsCdhData = cdhTypeData.map(item => ({    
                label: item.CYPNAME,
                value: item.CYPID
              }));
              this.chargeProjectTypes = legendsCdhData;
            }
            
              
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //个性化显示优惠金额
      getParam() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().Param.GetIsHidePreferential,
          res => {
            this.ishidePreferential = res.data.content;
          }
        );
      },
      //获取CHFPAYLOGO
      GetCHFPAYLOGO() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.GetCHFPAYLOGO,
          res => {
            this.chfpaylogos = res.data.content;
          }
        )
      },
      //获取收费项目状态
      getChaStatus() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.ChaStatus,
          res => {
            let cdhTypeData = res.data.content,
              legendsCdhData = cdhTypeData.map(item => ({
                label: item.Text,
                value: item.Value
              }));
            this.chaStatusTypes = legendsCdhData;
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //获取减免项目
      getChargeProjectReduction() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.QueryReduction,
          res => {
            let cdhTypeData = res.data.content,
              legendsCdhData = cdhTypeData.map(item => ({
                label: item.REDNAME,
                value: item.REDID
              }));
            this.chaReductionTypes = legendsCdhData;
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //获取计量单位
      getUint() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().Code.GetUint,
          res => {
            let cdhTypeData = res.data.content,
              legendsCdhData = cdhTypeData.map(item => ({
                label: item.CodeName,
                value: item.CodeValue
              }));
            this.chaUintsTypes = legendsCdhData;
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      // 获取生产厂家
      getSccjType(){
        apiBase.DoService(
          {},
          apiBase.getApiAdress().Depot.QueryVdrByZC,
          res => {
           this.SccjType = res.data.content.OutData;
          },
          res => {
            this.$message.error(res.data.msg);
          })
      },
      //获取历史价格表头
      getProjectPriceColumns() {
        let data = {};
        apiBase.DoService(
          data,
          apiBase.getApiAdress().Column.GetChargeProjectPriceColumns,
          res => {
            this.headListLSJG = res.data.content;
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //功能操作
      open(order, id,name) {
        this.order = order;
        this.getAllCharge()
        this.dataRepeat();
        this.getParam();
        switch (this.order) {
          case ADD:
            this.title = "收费项目新增";
            this.initSelectData();
            this.$refs.dialog.open();
            break;
          case ADDPRICE:
            this.title = "新增实收限价";
            this.initSelectData();
            this.userData.RTFCHAID=id;
            this.userData.CHANAME=name;
            this.$refs.dialogaddPrice.open();
            break;
          case MODIFYPROJECT:
            this.title = "收费项目修改";
            this.initSelectData();
            this.dataInfo(id);
            this.$refs.dialogProject.open();
            break;
          case MODIFYPRICE:
            this.title = "收费价格修改";
            this.initSelectData();
            this.dataInfo(id);
            this.$refs.dialogPrice.open();
            break;
          case DELETE:
            this.dataDelete(id);
            break;
          case INFO:
            this.title = "收费项目详情";
            this.dataInfo(id);
            this.$refs.dialogInfo.open();
            break;
          default:
        }
      },
      //提交
      submit() {
        this.$store.state.isloading = true;
        switch (this.order) {
          case ADD:
            this.dataAdd();
            break;
          case MODIFYPROJECT:
            this.dataModifyProject();
            break;
          case MODIFYPRICE:
            this.dataModifyPrice();
            break;
          case DELETE:
            break;
          case INFO:
            this.$refs.dialogInfo.close();
            break;
          case ADDPRICE:
            this.dataAddPrice();
            break;  
          default:
        }
      },
      //取消
      cancel() {
        this.$refs.dialogProject.close();
        this.$refs.dialogaddPrice.close();  //上虞新增实收现价
        this.$refs.dialog.close();
        this.$refs.dialogInfo.close();
        this.$refs.dialogPrice.close();
      },
      // 收费项目新增
      dataAdd() {
        let data = JSON.parse(JSON.stringify(this.chaData));
        if (data.CHASTADATE)
          data.CHASTADATE = formatDate(data.CHASTADATE, "yyyyMMdd");
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.Create,
          res => {
            this.refreshData();
            this.$refs.dialog.close();
            this.$message({
              message: this.order + res.data.msg,
              type: "success"
            });
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //收费项目修改
      dataModifyProject() {
        let data = JSON.parse(JSON.stringify(this.chaData));
        this.cdhTypeDatas.forEach(item => {
          if(data.CHACYPID == item.CYPNAME) {
            data.CHACYPID = item.CYPID;
          }
        });
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.Modify,
          res => {
            this.refreshData();
            this.$refs.dialogProject.close();
            this.$message({
              message: this.order + res.data.msg,
              type: "success"
            });
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //价格修改
      dataModifyPrice() {
        let Data = JSON.parse(JSON.stringify(this.chaData));
        if (Data.CHASTADATE)
          Data.CHASTADATE = formatDate(Data.CHASTADATE, "yyyyMMdd");
        apiBase.DoService(
          Data,
          apiBase.getApiAdress().ChargeProject.ModifyPrice,
          res => {
            this.refreshData();
            this.$refs.dialogPrice.close();
            this.$message({
              message: this.order + res.data.msg,
              type: "success"
            });
          },
          res => {
            this.$message.error(res.data.msg);
          }
        );
      },
      //收费项目删除
      dataDelete(id) {
        this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(callback => {
          var data = {
            CHAID: id
          };
          apiBase.DoService(
            data,
            apiBase.getApiAdress().ChargeProject.Delete,
            res => {
              this.refreshData();
              this.$message({
                message: this.order + res.data.msg,
                type: "success"
              });
            },
            res => {
              this.$message.error(res.data.msg);
            }
          );
        });
      },
      //收费项目详情
      dataInfo(id) {
        var data = {
          CHAID: id
        };
        apiBase.DoService(
          data,
          apiBase.getApiAdress().ChargeProject.Detail,
          res => {
            // CHACYPID     CYPNAME
            this.chaData = res.data.content;
            this.chaData.CHACYPID = this.chaData.CYPNAME;
            this.chaData.CHAID = id;
          }
        );
      },
          //新增提交
    dataAddPrice() {
      let Data = JSON.parse(JSON.stringify(this.userData));
      apiBase.DoService(Data, apiBase.getApiAdress().PaidPriceLimit.UpdateAddPaidPriceLimit, res => {
        this.$refs.dialogaddPrice.close();
        this.refreshData();
        this.$message({
          type: "success",
          message: "新增成功!"
        });
      }, res =>{
        this.$message.error(res.data.msg);
      });
    },
      //查询条件重置
      btnRepeat() {
        this.selectData = {};
        this.refreshData();
      },
      //数据重置
      dataRepeat() {
        this.chaData = {};
        this.userData = {};
      },
      openDialogProject() {
        this.order = MODIFYPROJECT;
        this.title = "收费项目修改";
        this.dataInfo();
        this.$refs.dialogProject.open();
      },
      openDialogPrice() {
        this.order = MODIFYPRICE;
        this.title = "收费项目价格修改";
        this.dataInfo();
        this.$refs.dialogPrice.open();
      },
      openDialogLSPrice() {
        this.order = CKLSJG;
        this.title = "收费项目历史价格查询";
        this.sweetModalWidth = 80;
        this.sweetModalMaxWidth = 1000;
        this.hiddenColumn = false;
        this.getPriceHistory();
        this.$refs.dialogLSPrice.open();
      },
      //初始化下拉框数据
      initSelectData() {
        //上虞实收现价
        this.getChargepro();
        this.getChargeProjectType();
        this.GetCHFPAYLOGO();
        this.getChaStatus();
        this.getChargeProjectReduction();
        this.getUint();
      },
      refreshData() {
        this.$emit("refreshData");
      }
    },
    components: {
      sweetModal
    },
    mounted() {},
    created() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Param.GetIsDPGPushCHA, res => {
         this.IsDPGPushCHA = res.data.content;
      });
      this.getSccjType()
    },
    // watch: {
    //   "chaData.CHASTADATE": function(val) {
    //     this.chaData.CHASTADATE = formatDate(val, "yyyy-MM-dd");
    //   }
    // }
  };
</script>
